<?php
/**
 * Created by PhpStorm .
 * User: 杜磊磊
 * Date: 2020/6/24
 * Time: 14:46
 */

namespace app\admin\validate;

use think\Validate;

class AdminUser extends Validate
{
    protected $rule =   [
        'username'  => 'require',
        'password'   => 'require',
        'captcha' => 'require|checkCaptcha',
    ];

    protected $message  =   [
        'username' => '用户名必须',
        'password'     => '密码必须',
        'captcha'   => '验证码必须',
    ];

    //验证码
    protected function checkCaptcha($value,$rule,$data=[])
    {
        if (!captcha_check($value)){
            return "您输入的验证码不正确";
        }
        return true;
    }
}
